package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ShuffleAnArrayOfTypeT {
	public static <T> void shuffle(T[] array) {
		for (int i = array.length; i > 1; i--) {
			T temp = array[i - 1];
			int randIx = (int) (Math.random() * i);
			array[i - 1] = array[randIx];
			array[randIx] = temp;
		}
	}
}
